#pragma once
#include "vector.h"
#include <Common/device_type.h>

namespace shermit {
	/*
	* template class for Planar Uniform BSpline Curve on CPU and GPU(CUDA)
	*/
	template<typename Float_t, int _degree, DeviceType _dev>
	class BSplineCurve {
	public:
		using vec_t = nv::vec2<Float_t>;
		int degree() const;  // max degree of the curve's polynomials
		int nControlPts() const;  // num of control points
		int nKnots() const;  // num of knots
		const vec_t* getControlPts() const; // get control points array

		vec_t at(Float_t t) const;
		vec_t df(Float_t t, unsigned int order) const; // k-order differential of f(t)
		vec_t tangent(Float_t t) const;
		vec_t normal(Float_t t) const;  // pointing away from the curvature circle
		Float_t curvature(Float_t t) const;
	};

	template<typename Float_t, DeviceType _dev>
	using CubicBSplineCurve = BSplineCurve<Float_t, 3, _dev>;
}